﻿@using Microsoft.ProjectServer.Client;
@model Microsoft.ProjectServer.Client.ProjectCollection

<table class="table">
    <thead>
        <tr>
            <th>
                Project Name
            </th>
            <th></th>
            <th></th>
        </tr>
    </thead>

    @foreach (PublishedProject item in Model)
    {
        <tr>
            <td>
                @item.Name
            </td>
            <td>
                @using (Ajax.BeginForm("GetProjectInfoPartial", "Projects", new { name = item.Name }, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = (item.Id + "Info"), OnBegin = "openModal", OnComplete = "closeModal" }, new { @class = "form-horizontal", role = "form" }))
                {
                    <button type="submit" class="btn btn-primary" name="btnGetProjectInfo">Get Project Info</button>
                }
                <div id="@(item.Id + "Info")"></div>
            </td>
            <td>
                @using (Ajax.BeginForm("GetProjectTasksPartial", "Projects", new { name = item.Name }, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = (item.Id + "Tasks"), OnBegin = "openModal", OnComplete = "closeModal" }, new { @class = "form-horizontal", role = "form" }))
                {
                    <button type="submit" class="btn btn-primary" name="btnGetProjectTasks">Get Project Tasks</button>
                }
                <div id="@(item.Id + "Tasks")"></div>
            </td>

            <td>
                @using (Ajax.BeginForm("DeleteProjectPartial", "Projects", new { name = item.Name }, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "publishedProjects", OnBegin = "openModal", OnComplete = "closeModal" }, new { @class = "form-horizontal", role = "form" }))
                {
                    <button type="submit" class="btn btn-danger" name="btnDeleteProject" >Delete project</button>
                }
            </td>
        </tr>
    }
</table>


